﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using Com.LongER.Framework.Utils.Dao.MessageDSTableAdapters;

namespace Com.LongER.Framework.Utils
{
	public class MessageRepository : IMessageRepository
	{
		public IEnumerable<MessageInfo> GetData()
		{
            var connectionString = ConnectionStringUtil.GetConnectionString();
            var ta = new M_MESSAGETableAdapter(connectionString);
			return ta.GetData()
				.Select(x => new MessageInfo
				{
                    ModuleName = x.MODULE_NAME,
                    MessageId = x.MESSAGE_ID,
                    Message = x.MESSAGE
				});
            
		}
	}
}
